package cn.tedu._05mvcboot01.controller;


import cn.tedu._05mvcboot01.pojo.dto.BMIDTO;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;



@Controller
public class BMIController {


    /**
     * 计算BMI
     * http://localhost:8080/bmi?weight=80&height=1.7
     * @param
     * @return
     */
    @RequestMapping("/bmi")
    @ResponseBody
    public String bmi(Double weight, Double height) {
//        Double weight = bmiDTO.getWeight();
//        Double height = bmiDTO.getHeight();

        Double V = weight / (height * height);
        if(V >=27) {
            return "该减肥了";
        } else if (V >24 ) {
            return  "微胖";
        } else if (V >18.5 ) {
            return "正常";
        } else {
            return "偏瘦";
        }
    }
}
